
let maxspeed = ref 30.;;
let set_maxspeed x = maxspeed := x;;

open Vector;;
open GraphicsGTK ;;

let draw_arrow vector color =
  match vector with
      Vec (angle,speed) ->
	set_color color;
	draw_vector center vector;
	if speed >= 0. then 
	  (
	    draw_vector vector (Vec(angle + 160,1.));
	    draw_vector vector (Vec(angle + 200,1.))
	  )
	else
	  (
	    draw_vector center (Vec(angle + 160,1.));
	    draw_vector center (Vec(angle + 200,1.))
	  )
;;

let draw_pointed_line (Vec (a,s)) = 
  let 
    i = ref 0.
  in
    while !i < s do
      draw_point (Vec(a,!i)) ;
      i := !i +. 1.
    done
;;


let draw_pointed_circle radius = 
  let 
    i = ref 0 
  and
    step = truncate (!maxspeed/. radius)
  in
    while !i < 360 do
      draw_point (Vec(!i,radius)) ;
      i := !i + step
    done
;;

